<% title "#{@project} published releases on #{@project.platform_name} - Libraries.io" %>
<% content_for :atom, auto_discovery_link_tag(:atom, project_versions_url({format: "atom"}.merge(@project.to_param))) %>

<h1>
  <%= link_to @project, project_path(@project.to_param) %> Releases
</h1>

<div class="row">
  <div class="col-sm-8">
    <% if @versions.any? %>
      <table class='table'>
        <% @versions.each do |version| %>
        <tr>
          <td>
            <%= link_to version, version_path(version.to_param) %>
          </td>
          <% if version.published_at.present? %>
            <td>
              <small class='text-muted'>
                <%= version.published_at.to_fs(:long_ordinal) %>
              </small>
            </td>
          <% end %>
          <% if version.related_tag %>
          <td>
            <small class='text-muted'>
              <%= link_to version.related_tag.repository_url do %>
                <%= fa_icon('tag') %>
                Browse source on <%= version.project.repository.host_type %>
              <% end %>
            </small>
          </td>
          <td>
            <% if @versions.count < 1000 && version.previous_version %>
              <small class='text-muted'>
                <%= link_to version.diff_url do %>
                  <%= fa_icon('random') %>
                  View diff between <%= version %> and <%= version.previous_version %>
                <% end %>
              </small>
            <% end %>
          </td>
          <% end %>
        </tr>
        <% end %>
      </table>
      <%= will_paginate @versions, page_links: true %>
      <p>
        <%= link_to project_versions_path(@project.to_param.merge(format: :atom)) do %>
          <%= fa_icon "rss-square" %>
          Subscribe to an RSS feed of <%= @project %> releases
        <% end %>
      </p>
    <% else %>
      <p>
        No releases found, go back to <%= link_to @project, project_path(@project.to_param) %>.
      </p>
    <% end %>
  </div>
  <div class="col-sm-4">

  </div>
</div>
